package com.supermap.guangzhou.weifang.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.supermap.guangzhou.weifang.R;
import com.supermap.guangzhou.weifang.adapter.RecyclerAdapter;
import com.supermap.guangzhou.weifang.utils.Utils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


/**
 *
 */
public class JiandingFragment extends Fragment {


    @BindView(R.id.jdbglr)
    RecyclerView jdbglr;
    @BindView(R.id.jdbgcx)
    RecyclerView jdbgcx;
    @BindView(R.id.jdbgsh)
    RecyclerView jdbgsh;
    @BindView(R.id.jdbgtj)
    RecyclerView jdbgtj;
    Unbinder unbinder;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_jianding, container, false);
        unbinder = ButterKnife.bind(this, view);
        initjdbglrView();
        initjdbgcxView();
        initjdbgshView();
        initjdbgtjView();
        return view;
    }

    private void initjdbgtjView() {
        List<String> names = new ArrayList<>();
        List<Integer> imgs = new ArrayList<>();
        names.add("安全鉴定报告统计1");
        names.add("安全鉴定报告统计2");
        names.add("安全鉴定报告统计3");
        imgs.add(R.drawable.ic_looks_one_black_24dp);
        imgs.add(R.drawable.ic_looks_two_black_24dp);
        imgs.add(R.drawable.ic_looks_3_black_24dp);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(Utils.getContext(), 4);
        jdbgtj.setLayoutManager(gridLayoutManager);
        jdbgtj.setAdapter(new RecyclerAdapter(Utils.getContext(), imgs,names));
    }

    private void initjdbgshView() {
        List<String> names = new ArrayList<>();
        List<Integer> imgs = new ArrayList<>();
        names.add("报告的申请修改状态");
        imgs.add(R.drawable.ic_group_work_black_24dp);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(Utils.getContext(), 4);
        jdbgsh.setLayoutManager(gridLayoutManager);
        jdbgsh.setAdapter(new RecyclerAdapter(Utils.getContext(), imgs,names));
    }

    private void initjdbgcxView() {
        List<String> names = new ArrayList<>();
        List<Integer> imgs = new ArrayList<>();
        names.add("危房报告查询");
        names.add("完损性报告查询");
        names.add("建筑结构可靠性报告查询");
        names.add("火灾后建筑结构报告查询");
        imgs.add(R.drawable.ic_new_releases_black_24dp);
        imgs.add(R.drawable.ic_ac_unit_black_24dp);
        imgs.add(R.drawable.ic_assessment_black_24dp);
        imgs.add(R.drawable.ic_wxfw_24dp);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(Utils.getContext(), 4);
        jdbgcx.setLayoutManager(gridLayoutManager);
        jdbgcx.setAdapter(new RecyclerAdapter(Utils.getContext(), imgs,names));
    }

    private void initjdbglrView() {
        List<String> names = new ArrayList<>();
        List<Integer> imgs = new ArrayList<>();
        names.add("危险房屋鉴定报告");
        names.add("房屋完损性鉴定报告");
        names.add("建筑结构可靠性鉴定报告");
        names.add("火灾后鉴定结构鉴定报告");
        imgs.add(R.drawable.ic_assignment_late_black_24dp);
        imgs.add(R.drawable.ic_fwwz_24dp);
        imgs.add(R.drawable.ic_jzjg_24dp);
        imgs.add(R.drawable.ic_hz_24dp);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(Utils.getContext(), 4);
        jdbglr.setLayoutManager(gridLayoutManager);
        jdbglr.setAdapter(new RecyclerAdapter(Utils.getContext(), imgs,names));
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
